

    \filetitle{graph}{Add graph to figure}{report/graph}

	\paragraph{Syntax}

\begin{verbatim}
P.graph(Cap,...)
\end{verbatim}

\paragraph{Input arguments}

\begin{itemize}
\item
  \texttt{P} {[} struct {]} - Report object created by the
  \href{report/new}{\texttt{report.new}} function.
\item
  \texttt{Cap} {[} char \textbar{} cellstr \textbar{} \texttt{@auto} {]}
  - Title, or cell array with title and subtitle, displayed at the top
  of the graph; \texttt{@auto} means that the first comment from the
  first child \texttt{series} object will be used for the title.
\end{itemize}

\paragraph{Options}

\begin{itemize}
\item
  \texttt{\textquotesingle{}axesOptions=\textquotesingle{}} {[} cell
  \textbar{} \emph{empty} {]} - (Inheritable) Options executed by
  calling \texttt{set} on the axes handle before running
  \texttt{\textquotesingle{}postProcess=\textquotesingle{}}.
\item
  \texttt{\textquotesingle{}dateTick=\textquotesingle{}} {[} numeric
  \textbar{} \emph{\texttt{Inf}} {]} - (Inheritable) Date tick spacing.
\item
  \texttt{\textquotesingle{}grid=\textquotesingle{}} {[} \texttt{@auto}
  \textbar{} \texttt{true} \textbar{} \texttt{false} {]} - (Inheritable)
  Display grid lines; if \texttt{@auto},
  \texttt{\textquotesingle{}grid=\textquotesingle{}} is \texttt{true}
  unless a right-hand-side axis is plotted.
\item
  \texttt{\textquotesingle{}legend=\textquotesingle{}} {[}
  \emph{\texttt{false}} \textbar{} \texttt{true} {]} - (Inheritable) Add
  legend to the graph.
\item
  \texttt{\textquotesingle{}legendLocation=\textquotesingle{}} {[} char
  \textbar{} \emph{\texttt{\textquotesingle{}best\textquotesingle{}}}
  \textbar{} \texttt{\textquotesingle{}bottom\textquotesingle{}}{]} -
  (Inheritable) Location of the legend box; see help on \texttt{legend}
  for values available.
\item
  \texttt{\textquotesingle{}postProcess=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - (Inheritable) String with Matlab
  commands executed after the graph has been drawn and styled; see
  Description.
\item
  \texttt{\textquotesingle{}preProcess=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - (Inheritable) String with Matlab
  commands executed before the graph has been drawn and styled; see
  Description.
\item
  \texttt{\textquotesingle{}range=\textquotesingle{}} {[} numeric
  \textbar{} \emph{\texttt{Inf}} {]} - (Inheritable) Graph range.
\item
  \texttt{\textquotesingle{}rhsAxesOptions=\textquotesingle{}} {[} cell
  \textbar{} \emph{empty} {]} - (Inheritable) Options executed by
  calling \texttt{set} on the RHS axes handle before running
  \texttt{\textquotesingle{}postProcess=\textquotesingle{}}.
\item
  \texttt{\textquotesingle{}style=\textquotesingle{}} {[} struct
  \textbar{} \emph{empty} {]} - (Inheritable) Apply this style structure
  to the graph and its children; see help on
  \href{grfun/style}{\texttt{grfun.style}}.
\item
  \texttt{\textquotesingle{}tight=\textquotesingle{}} {[} \texttt{@auto}
  \textbar{} \texttt{true} \textbar{} \texttt{false} {]} - (Inheritable)
  Set the y-axis limits to the minimum and maximum of displayed data; if
  \texttt{@auto}, \texttt{\textquotesingle{}tight=\textquotesingle{}} is
  \texttt{true} unless a right-hand-side axis is plotted.
\item
  \texttt{\textquotesingle{}xLabel=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - Label the x-axis.
\item
  \texttt{\textquotesingle{}yLabel=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - Label the y-axis.
\item
  \texttt{\textquotesingle{}zeroLine=\textquotesingle{}} {[}
  \texttt{true} \textbar{} \emph{\texttt{false}} \textbar{} cell {]} -
  (Inheritable) Add a horizontal zero line if zero is included on the
  y-axis; specify zeroline options in a cell array.
\end{itemize}

\paragraph{Date format options}

See \href{dates/dat2str}{\texttt{dat2str}} for details on date format
options.

\begin{itemize}
\item
  \texttt{\textquotesingle{}dateFormat=\textquotesingle{}} {[} char
  \textbar{} cellstr \textbar{}
  \emph{\texttt{\textquotesingle{}YYYYFP\textquotesingle{}}} {]} - Date
  format string, or array of format strings (possibly different for each
  date).
\item
  \texttt{\textquotesingle{}freqLetters=\textquotesingle{}} {[} char
  \textbar{} \emph{\texttt{\textquotesingle{}YHQBMW\textquotesingle{}}}
  {]} - Six letters used to represent the six possible frequencies of
  IRIS dates, in this order: yearly, half-yearly, quarterly, bi-monthly,
  monthly, and weekly (such as the
  \texttt{\textquotesingle{}Q\textquotesingle{}} in
  \texttt{\textquotesingle{}2010Q1\textquotesingle{}}).
\item
  \texttt{\textquotesingle{}months=\textquotesingle{}} {[} cellstr
  \textbar{}
  \emph{\texttt{\{\textquotesingle{}January\textquotesingle{},...,\textquotesingle{}December\textquotesingle{}\}}}
  {]} - Twelve strings representing the names of the twelve months.
\item
  \texttt{\textquotesingle{}standinMonth=\textquotesingle{}} {[} numeric
  \textbar{} \texttt{\textquotesingle{}last\textquotesingle{}}
  \textbar{} \emph{\texttt{1}} {]} - Month that will represent a
  lower-than-monthly-frequency date if the month is part of the date
  format string.
\end{itemize}

\paragraph{Generic options}

See help on \href{report/Contents}{generic options} in report objects.

\paragraph{Description}

The options \texttt{\textquotesingle{}preProcess=\textquotesingle{}} and
\texttt{\textquotesingle{}postProcess=\textquotesingle{}} give you
additional flexibility in customising the graphics style of the axes
object. The values assigned to these options are expected to be strings
with an executable Matlab command, or commands separated with
semi-colons (as if typed on one line in the command window). The command
can refer to the following variables:

\begin{itemize}
\tightlist
\item
  \texttt{H} - a handle to the currently processed axes object.
\item
  \texttt{L} - a handle to the corresponding legend object; if no legend
  object exists for the axes \texttt{H}, \texttt{L} will be
  \texttt{NaN}.
\end{itemize}

\paragraph{Example}

Create a one-page report with a chart in on the LHS and the legend moved
to the RHS. Use the function \texttt{grfun.movetosubplot} in the option
\texttt{\textquotesingle{}postProcess=\textquotesingle{}}, referring to
\texttt{L} (handle to the legend object associated with the respective
axes object) to move the legend around.

\begin{verbatim}
% Create random data series.
A = tseries(1:10,@rand);
B = tseries(1:10,@rand);

% Open a new report.
x = report.new();

% Open a new figure in the report with a 1-by-2 layout.
x.figure('My Figure','subplot=',[1,2]);

    % The graph will be placed in the LHS space.
    % Use `grfun.movetosubplot` to move the legend to the RHS space.
    x.graph('My Graph','legend=',true, ...
        'postProcess=','grfun.movetosubplot(L,1,2,2)');

        x.series('Series A',A);
        x.series('Series B',B);

x.publish('test.pdf');
open test.pdf;
\end{verbatim}


